| Conditions | 2 |
| Total Lines | 15 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import {QueryHandler} from '@nestjs/cqrs'; |
||
| 15 | |||
| 16 | public async execute(query: GetProjectByIdQuery): Promise<ProjectView> { |
||
| 17 | const project = await this.projectRepository.findOneById(query.id); |
||
| 18 | if (!project) { |
||
| 19 | throw new ProjectNotFoundException(); |
||
| 20 | } |
||
| 21 | |||
| 22 | const customer = project.getCustomer(); |
||
| 23 | |||
| 24 | return new ProjectView( |
||
| 25 | project.getId(), |
||
| 26 | project.getName(), |
||
| 27 | project.getDayDuration(), |
||
| 28 | project.getInvoiceUnit(), |
||
| 29 | new CustomerView(customer.getId(), customer.getName()) |
||
| 30 | ); |
||
| 33 |